<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    半径<input type="text" id="a">
    <button onclick="ab()">提交</button>
    <script>
        //编写函数，求圆的面积
        function ab() {
            var r = document.getElementById("a").value;
            var area = parseInt(3.14 * r * r);
            alert("半径为" + r + "的圆面积为:" + area);
        }
    </script>
</body>

</html>